import numpy as np
import pandas as pd

# 1.Series创建（一维Pandas数据结构，由 index+value 构成）

# 0    0
# 1    1
# 2    2
# 3    3
# 4    4
# 5    5
# 6    6
# 7    7
# 8    8
# 9    9
# dtype: int32
print(pd.Series(data=np.arange(10)).sort_index())
print(pd.Series(data=[1, 2, 3, 4, 5, 6], index=[1, 2, 3, 4, 5, 6], dtype=np.int32).sort_values())
colors = pd.Series({"red": 1, "green": 2, "blue": 3})
# red      1
# green    2
# blue     3
# dtype: int64
print(colors)

# 2. Series属性
colors.dtype
print(colors.index)  # Index(['red', 'green', 'blue'], dtype='object')
print(colors.values)  # [1 2 3]

print(colors[0])
